Skip to content

[Prism] Fix race condition and nil pointer dereferencing - #36370

Merged
shunping merged 3 commits into
apache:masterfrom
shunping:prism-after-processing-time-3
Oct 3, 2025
Merged

[Prism] Fix race condition and nil pointer dereferencing#36370
shunping merged 3 commits into
apache:masterfrom
shunping:prism-after-processing-time-3

Conversation

@shunping

@shunping shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

fixes #36366

I ran the tests for about 10k times and saw no failure after the fix.

Prior to that, the failure rate is about 1 in 100 for the race condition and 1 in 1000 for the nil pointer dereferencing.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunping, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the stability and reliability of the prism runner by addressing critical runtime issues. It includes fixes for a potential nil pointer dereference and a race condition, alongside improvements to error handling through more comprehensive logging for panics. These changes collectively aim to prevent unexpected crashes and provide better diagnostic information when issues do occur.

Highlights

  • Nil Pointer Dereference Fix: Introduced a nil check for dnt (derived from ss.pendingByKeys[key]) in the buildTriggeredBundle function to prevent potential nil pointer dereferences, ensuring the function returns gracefully if no pending elements are found for a given key.
  • Race Condition Mitigation: Implemented a mutex lock (em.refreshCond.L.Lock() and Unlock()) around the scheduling of processing time events (em.processTimeEvents.Schedule) to resolve a potential race condition and ensure thread-safe access to shared resources.
  • Enhanced Error Logging: Added structured logging (slog.Error) to capture panics that occur within the ElementManager.Bundles watermark evaluation goroutine, providing more detailed context including the error and traceback for improved debugging.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@shunping

shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

R: @liferoad

@shunping shunping self-assigned this Oct 3, 2025
@github-actions

github-actions Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@shunping
shunping requested a review from liferoad October 3, 2025 04:07
@codecov

codecov Bot commented Oct 3, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.19%. Comparing base (3534960) to head (3f88c27).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...am/runners/prism/internal/engine/elementmanager.go 0.00% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #36370      +/-   ##
============================================
- Coverage     40.20%   40.19%   -0.01%     
  Complexity     3386     3386              
============================================
  Files          1220     1220              
  Lines        186149   186159      +10     
  Branches       3523     3523              
============================================
- Hits          74839    74825      -14     
- Misses       107955   107979      +24     
  Partials       3355     3355              
Flag Coverage Δ
go 28.42% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shunping

shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks!

@shunping
shunping merged commit 1c8bcf9 into apache:master Oct 3, 2025
13 of 15 checks passed
@shunping shunping changed the title Fix race condition and nil pointer dereferencing [Prism] Fix race condition and nil pointer dereferencing Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Failing Test]: Data race detected on TriggerAfterProcessingTimeNotTriggered

2 participants